<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="referrer" content="no-referrer" />
    <title>审核短运司机信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Pragma" content="no-cache">
	<meta http-equiv="Cache-Control" content="no-cache">
	<meta http-equiv="Expires" content="0">
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/animate.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/jQuery-Validation/css/validationEngine.jquery.css" rel="stylesheet">
    <style type="text/css">
        .formErrorContent{
            color: red;
        }
    </style>
</head>
<body class="gray-bg" style="height:auto;">
<div class="formErrorContent"></div>
    <div class="container driverContent" style="margin-top: 50px">
        <form class="form-horizontal" role="form" id="editShortDriverForm">
                <input type="hidden" name="id" id="driverId">
                <div class="form-group">
                    <label class="col-sm-4 control-label">用户名:</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="driverName" id="driverName" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4 control-label">真实姓名:</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="driverRealName" id="driverRealName" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4 control-label">身份证号:</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="driverIdcard" id="driverIdcard"  readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4 control-label">驾照号:</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="driverLicence" id="driverLicence" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4 control-label">手机号:</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="driverPhone" id="driverPhone" readonly="readonly">
                    </div>
                </div>
                <div class="form-group imgshow">
                    <label class="col-xs-4 control-label">驾照图片:</label>
                    
                    <div class="col-xs-4 driver_img">
                        <img alt="驾照图片" src="" width="200" style="height:200px;" class="img-thumbnail img_large" name="driverLicencePic" id="driverLicencePic" readonly="readonly">
                    </div>
                    
                </div>
                
                <div class="form-group" style="margin-left: 217px;margin-top:20px">
                    <div class="control-label">
                        <button type="button" class="btn btn-default" onclick="closeForm();">关闭</button>
                        &nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-primary"  id="pass" >通过</button>
                        &nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-primary"  id="refuse" >拒绝</button>
                    </div>
                </div>
         </form>
    </div>
   	<div class="driversign" style="text-align:right; position:absolute; top:20px; display:none;">
   		<img class="drivercardrotate" id="drivercardrotate" width="30px" height="30px"  src="${pageContext.request.contextPath}/img/drivercardrotate.png">
   		<img class="drivercardclose" width="26px" height="26px" style="margin:0 10px;" src="${pageContext.request.contextPath}/img/driverclose.png">
   	</div>
   </div>
<script src="${pageContext.request.contextPath}/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/js/content.min.js?v=1.0.0"></script>
<script src="${pageContext.request.contextPath}/js/plugins/layer/layer.min.js"></script>
<script src="${pageContext.request.contextPath}/js/public/ttbj-core.js"></script>
<script src="${pageContext.request.contextPath}/jQuery-Validation/js/jquery.validationEngine.js"></script>
<script src="${pageContext.request.contextPath}/jQuery-Validation/js/jquery.validationEngine-zh_CN.js"></script>

<script type="text/javascript">
var driverId;
$(function () {
	driverId = $.getUrlParam("id");
	status = $.getUrlParam("status");
	//回显短运司机的信息
	echoCompanyInfo();
	//当status为0时，说明是没有审核的信息
	if(status == 0){
		//获取手机号
		var phone = $("#driverPhone").val();
		//司机姓名
		var realName = $("#driverRealName").val();
		//审核通过
		$("#pass").click(function(){
			operation("pass", phone, driverId, realName);
		});
		//审核不通过
		$("#refuse").click(function(){
			operation("refuse", phone, driverId, realName);
		});
	}else if(status == 1 || status == 2){ //statu为1或2时，说明已经是审核过的
		$("#pass, #refuse").remove();
		$(".form-group:last").attr("style", "margin-left: 305px;margin-top: 50px");
	}
	$(".img_large").click(function(){
		$(".driversign").show();
		$(".form-group").not(".imgshow").hide();
		$(".imgshow label").hide();
		$(".driverContent").css({"width":"100%"});
		$(".imgshow").css({"position":"absolute","top":"50px","width":"100%","z-index":"9999","text-align":"center"});
		$(".driver_img").css({"width":"100%"});
		$(this).css({"width":"auto","height":"auto"})
	})
	var deg = 0;
    document.getElementById("drivercardrotate").onclick = function () {
        deg += 90;
        document.getElementById("driverLicencePic").style.transform = "rotate(" + deg + "deg)";
    }
    $(".drivercardclose").click(function(){
    	$(".driversign").hide();  
    	$(".driverContent").show();
    	$(".form-group").show();
    	$(".imgshow label").show();
    	$(".imgshow").css({"position":"static","margin-left":"0"})
    })
});


//把司机信息显示出来
function echoCompanyInfo(){
    $.ajax({
        url: "../driver/echoShortDriverInfo.htm",
        cache: false,
        async : false,
        type: "get",
        dataType: "json",
	    data: {driverId: driverId},
        success: function (result) {
            if (result.status == 0) {
                var data = result.data;
                $("#editShortDriverForm").formatForm(data);
                $("#driverLicencePic").attr("src", data.driverLicencePic);
                return;
            }
        }
    });
}

//审核操作
function operation(operation, phone, driverId, realName){
    $.ajax({
        url: "../driver/toExamineEsendSms.htm",
        cache: false,
        type: "post",
        dataType: "json",
        data : {"operation": operation, "phone": phone, "driverId": driverId, "realName": realName},
        success: function (result) {
            if (result.status == 0) {
                parent.layer.msg(result.message, {icon: 1});
                parent.$table.bootstrapTable('refresh', {url: '../driver/getShortDriverInfoByPage.htm'});
                closeForm();
            } else {
                parent.layer.msg(result.message, {icon: 2});
            }
        }
    });
}

//关闭窗口
function closeForm() {
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    parent.layer.close(index);
}
</script>
</body>
</html>